import request from "@/utils/request";

// 获取文章列表信息
export const getArticles = params => {
  return request({
    method: 'GET',
    url: '/v1_0/articles',
    params
  })
}

export const articlesAPI = id => {
  return request({
    method: 'GET',
    url: `/v1_0/articles/${id}`,
  })
}

// 点击收藏接口函数
export const addCollect = id => request({
  method: 'POST',
  url: '/v1_0/article/collections',
  data: {
    target: id
  }
})

// 点击取消收藏接口函数
export const deleteCollect = id => request({
  method: 'DELETE',
  url: `/v1_0/article/collections/${id}`
})

// 点赞接口axios函数
export const addLike = id => request({
  method: 'POST',
  url: '/v1_0/article/likings',
  data: {
    target: id
  }
})

// 点击取消点赞接口函数
export const deleteLike = id => request({
  method: 'DELETE',
  url: `/v1_0/article/likings/${id}`
})